<template>
  <div class="wrapper">
    <swiper :options="swiperOption">
      <!-- slides -->
      <swiper-slide v-for="item of list"
                    :key="item.id">
        <img class="swiper-img"
             :src="item.imgUrl"
             alt="">
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination"
           slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
export default {
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: {
          el: '.swiper-pagination'
        },
        loop: true
      }
    }
  }
}
</script>
<style lang="stylus" scoped>
// 样式穿透，只要wrapper下面的组件出现这个类就执行css，不受scoped的限制
.wrapper>>> .swiper-pagination-bullet-active
  background: red
.wrapper
  width: 100%
  height: 0
  padding-bottom: 23.5%
  margin-bottom: 0.2rem
  overflow: hidden
  .swiper-img
    width: 100%
</style>
